home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNUC / GCC-281S.LZH / config / m68k / mint.h next >
Encoding:
C/C++ Source or Header  |  1998-08-11  |  14.3 KB  |  466 lines

  1. /* Definitions of target machine for GNU compiler.
  2.    Atari ST TOS/MiNT.
  3.    Copyright (C) 1994, 1995 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 1, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 59 Temple Place - Suite 330,
  20. Boston, MA 02111-1307, USA.  */
  21.  
  22. #include "m68k/m68k.h"
  23.  
  24. #if defined(__GNUC__)
  25. #if defined(alloca)
  26. #undef alloca
  27. #endif
  28. #define alloca(x) __builtin_alloca(x)
  29. #endif
  30.  
  31. #define TARGET_DEFAULT 0            /* use this for a regular ST */
  32. /*
  33.  * TARGET_DEFAULT 2            use this for a ST with 68881/82
  34.  * TARGET_DEFAULT 5            use this for a TT withOUT 68881/82
  35.  * TARGET_DEFAULT 7            use this for a TT with 68881/82
  36.  * TARGET_DEFAULT 0407        use this for a Falcon 
  37.  *                                    may be vaporware but we are ready for it. yeah!!
  38.  *                                    USE this for a 68040, when -m68040 is specified. 
  39.  *                                    In this mode, the 881/2 instructions not on the 
  40.  *                                    040 are not produced see TARGET_68040 in m68k.h
  41.  *                                   (also note the difference vs TARGET_68040_ONLY) 
  42. */
  43.  
  44. /* Pass the architecture flags to the assembler. */ 
  45. #define COMMON_ASM_SPEC \
  46.   "%{m68000} %{mc68000} %{m68020} %{mc68020} %{m68020-40:-m68020} %{m68030} " \
  47.   "%{m68040} %{m68881} %{msoft-float:-mno-68881} %{m68851} %{mno-68851} " \
  48.   "%{m68302} %{mno-68302} %{m68332} %{mno-68332}"
  49.  
  50. #if (TARGET_DEFAULT & 01000)
  51. /* note atleast gas-1.38 Patchlevel 2 required for mc68040 specific
  52.    support in the assembler.  */
  53. #define ASM_SPEC "%{!m680*:%{!mc680*:-m68040}} " COMMON_ASM_SPEC
  54. #else
  55. /* falcon/TT */
  56. #if (TARGET_DEFAULT & 5) /* note this is true for TARGET_DEFAULT == 0407 too */
  57. /* for the TT etc (020/030) also appropriate for m68040 (falcon) ie:
  58.    -m68020-40 (and not -m68040). Note that the assembler does not need
  59.    any special indication of the 040 when -m68020-40, only needs
  60.    -mc68020. the only time the assembler needs -mc68040 is when
  61.    -m68040 */
  62. #define ASM_SPEC COMMON_ASM_SPEC
  63. #else
  64. /* for a regular 68k ST */
  65. #if (TARGET_DEFAULT & 2)
  66. #define ASM_SPEC \
  67.  "%{!m680*:%{!mc680*:-m68000 %{!msoft-float:-m68881}}} "\
  68.  COMMON_ASM_SPEC
  69. #else
  70. #define ASM_SPEC \
  71.  "%{m68060:-mc68060} "\
  72.  "%{m68040:-mc68040} "\
  73.  "%{!m68060:%{!m68040:%{!mc68020:%{!m68020*:%{!m68030:%{!mc68030:-mc68000}}}}}}"
  74. #endif
  75. #endif /* TT /falcon */
  76. #endif /* m68040-only */
  77.  
  78. /* Register to use for base-relative addressing. The BASE_ADDR_* macros
  79.    are for using GNU cpp's stringification feature. */
  80.  
  81. #define BASE_ADDR_REG    4        /* a4 */
  82. #undef PIC_OFFSET_TABLE_REGNUM
  83. #define PIC_OFFSET_TABLE_REGNUM    (BASE_ADDR_REG+8)    /* GCC register num */
  84. #define BASE_ADDR_STRING(X)    "a" #X
  85. #define BASE_ADDR_NAME(X)    BASE_ADDR_STRING(X)
  86.  
  87. #undef SUBTARGET_SWITCHES
  88. #define SUBTARGET_SWITCHES            \
  89.     { "pcrel", MASK_PCREL},                \
  90.     { "nopcrel", -MASK_PCREL},            \
  91.     { "baserel", MASK_BASEREL},            \
  92.     { "nobaserel", -MASK_BASEREL},     \
  93.     { "int", 010000},                \
  94.     { "noint", -010000},
  95.  
  96. #undef SUBTARGET_OVERRIDE_OPTIONS
  97. #define SUBTARGET_OVERRIDE_OPTIONS \
  98.   if (TARGET_BASE_REL) flag_pic = 3;
  99.  
  100. #define COMMON_CPP_SPEC \
  101. "%{mshort:-D__MSHORT__} "\
  102. "%{mbaserel:-D__MBASE__=" BASE_ADDR_NAME (BASE_ADDR_REG)\
  103.   " -D__MBASESTR__=\"" BASE_ADDR_NAME (BASE_ADDR_REG) "\"}"
  104.  
  105. #if (TARGET_DEFAULT & 5)
  106. #if (TARGET_DEFAULT & 2)
  107. #define CPP_SPEC \
  108.  "%{m68881:%{m68000:-D__M68881__} %{mc68000:-D__M68881__}} "\
  109.  "%{!m68000:%{!mc68000:"\
  110.    "%{!msoft-float:-D__M68881__} "\
  111.    "-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}}} "\
  112.  COMMON_CPP_SPEC
  113. #define CC1_SPEC \
  114.  "%{!m68881:%{m68000:-msoft-float} %{mc68000:-msoft-float}}"
  115. #else
  116. #define CPP_SPEC \
  117.  "%{m68881:-D__M68881__} "\
  118.  "%{!m68000:%{!mc68000:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}}} "\
  119.  COMMON_CPP_SPEC
  120. #endif
  121. #else
  122. #if (TARGET_DEFAULT & 2)
  123. #define CPP_SPEC \
  124.  "%{!msoft-float:-D__M68881__} "\
  125.  "%{m68020*:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  126.  "%{mc68020:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  127.  "%{m68030:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  128.  "%{m68040:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  129.  COMMON_CPP_SPEC
  130. #else
  131. #define CPP_SPEC \
  132.  "%{m68881:-D__M68881__} "\
  133.  "%{m68020*:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  134.  "%{mc68020:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  135.  "%{m68030:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  136.  "%{m68040:-D__M68020__ -D__mc68020__ %{!ansi:-Dmc68020}} "\
  137.  COMMON_CPP_SPEC
  138. #endif
  139. #endif
  140.  
  141. /* Names to predefine in the preprocessor for this target machine.  */
  142. #define CPP_PREDEFINES "-Dmc68000 -Datarist -Dgem -Asystem(tos) -Asystem(gem) -Acpu(m68k) -Amachine(m68k)"
  143.  
  144. /* specs for start file and link specs */
  145. #define STARTFILE_SPEC  "%{mbaserel:b}%{pg:g}crt0.o%s"
  146.  
  147. /* specs for libraries and linker */
  148. #define LIB_SPEC "-lc"
  149.  
  150. #define LIBGCC_SPEC ""
  151.  
  152. #define LINK_SPEC "%{mbaserel:-n} %{mshort:-H}"
  153.  
  154.  
  155. #define PTRDIFF_TYPE "long int"
  156. #define SIZE_TYPE "long unsigned int"
  157.  
  158. /* We must override m68k.h.  */
  159. #undef WCHAR_TYPE
  160. #undef WCHAR_TYPE_SIZE
  161. #define WCHAR_TYPE "short unsigned int"
  162. #define WCHAR_TYPE_SIZE 16
  163. #define WCHAR_UNSIGNED 1
  164.  
  165. #if 1
  166. /* Don't try using XFmode.  */
  167. #undef LONG_DOUBLE_TYPE_SIZE
  168. #define LONG_DOUBLE_TYPE_SIZE 64
  169. #endif
  170.  
  171. /* Alignment of field after `int : 0' in a structure.  */
  172. /* recent gcc's have this as 16, this is left in for the benfit of */
  173.  /* older gcc */
  174. #undef EMPTY_FIELD_BOUNDARY
  175. #define EMPTY_FIELD_BOUNDARY 16
  176.  
  177. /* Every structure or union's size must be a multiple of 2 bytes.  */
  178. #define STRUCTURE_SIZE_BOUNDARY 16
  179.  
  180. #undef PREFERRED_DEBUGGING_TYPE
  181. #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
  182. #define DBX_DEBUGGING_INFO
  183.  
  184. #ifdef abort
  185. #undef abort
  186. #define abort fancy_abort
  187. #endif
  188.  
  189. /* Allow folding division by zero.  */
  190. #define REAL_INFINITY
  191.  
  192. /* Generate calls to memcpy, memcmp and memset.  */
  193. #define TARGET_MEM_FUNCTIONS
  194.  
  195. /* The value of `EDOM' on the target machine.  */
  196. #define TARGET_EDOM 89
  197.  
  198. /* This is how to create a rtl expression that refers to the global
  199.    "variable" `errno'.  */
  200. #define GEN_ERRNO_RTX \
  201.   gen_rtx (MEM, TARGET_SHORT ? HImode : SImode, \
  202.        gen_rtx (SYMBOL_REF, Pmode, "errno"))
  203.  
  204. #define FUNCTION_VALUEX(MODE)                    \
  205.   gen_rtx (REG, (MODE), (TARGET_68881 && FLOAT_MODE_P (MODE) ? 16 : 0))
  206.  
  207. #undef FUNCTION_VALUE
  208. #define FUNCTION_VALUE(VALTYPE,FUNC) FUNCTION_VALUEX (TYPE_MODE (VALTYPE))
  209. #undef LIBCALL_VALUE
  210. #define LIBCALL_VALUE(MODE) FUNCTION_VALUEX (MODE)
  211.  
  212. /* 1 if N is a possible register number for a function value.  */
  213.  
  214. #undef FUNCTION_VALUE_REGNO_P
  215. #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (TARGET_68881 && (N) == 16))
  216.  
  217. /* Define this to be true when FUNCTION_VALUE_REGNO_P is true for
  218.    more than one register.  */
  219.  
  220. #undef NEEDS_UNTYPED_CALL
  221. #define NEEDS_UNTYPED_CALL (TARGET_68881)
  222.  
  223. /* This is how to output an assembler line defining a `double' constant.  */
  224.  
  225. #undef ASM_OUTPUT_DOUBLE
  226. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                \
  227.   {                                \
  228.     if (REAL_VALUE_ISINF (VALUE))                \
  229.       {                                \
  230.     if (REAL_VALUE_NEGATIVE (VALUE))            \
  231.       fprintf (FILE, "\t.double 0r-Inf\n");            \
  232.     else                            \
  233.       fprintf (FILE, "\t.double 0rInf\n");            \
  234.       }                                \
  235.     else if (REAL_VALUE_ISNAN (VALUE))                \
  236.       { long l[2];                        \
  237.     REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);            \
  238.     fprintf (FILE, "\t.long 0x%lx\n\t.long 0x%lx\n", l[0], l[1]); \
  239.       }                                \
  240.     else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  241.       {                                \
  242.     fprintf (FILE, "\t.double 0r-0.0\n");            \
  243.       }                                \
  244.     else                            \
  245.       { char dstr[30];                        \
  246.     REAL_VALUE_TO_DECIMAL (VALUE, "%.17g", dstr);        \
  247.     fprintf (FILE, "\t.double 0r%s\n", dstr);        \
  248.       }                                \
  249.     }
  250.  
  251. /* This is how to output an assembler line defining a `float' constant.  */
  252.  
  253. #undef ASM_OUTPUT_FLOAT
  254. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                \
  255.   {                                \
  256.     if (REAL_VALUE_ISINF (VALUE))                \
  257.       {                                \
  258.     if (REAL_VALUE_NEGATIVE (VALUE))            \
  259.       fprintf (FILE, "\t.single 0r-Inf\n");            \
  260.     else                            \
  261.       fprintf (FILE, "\t.single 0rInf\n");            \
  262.       }                                \
  263.     else if (REAL_VALUE_ISNAN (VALUE))                \
  264.       { long l;                            \
  265.     REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);            \
  266.     fprintf (FILE, "\t.long 0x%lx\n", l);            \
  267.       }                                \
  268.     else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  269.       {                                \
  270.     fprintf (FILE, "\t.single 0r-0.0\n");            \
  271.       }                                \
  272.     else                            \
  273.       { char dstr[30];                        \
  274.     REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr);        \
  275.     fprintf (FILE, "\t.single 0r%s\n", dstr);        \
  276.       }                                \
  277.     }
  278.  
  279. /* This is how to output an assembler lines defining floating operands.  */
  280.   
  281. #undef ASM_OUTPUT_FLOAT_OPERAND
  282. #define ASM_OUTPUT_FLOAT_OPERAND(CODE,FILE,VALUE)        \
  283.  do {                                \
  284.       if (CODE != 'f' || REAL_VALUE_ISNAN (VALUE))        \
  285.     {                            \
  286.       long l;                        \
  287.       REAL_VALUE_TO_TARGET_SINGLE (VALUE, l);        \
  288.       asm_fprintf (FILE, "%I");                \
  289.       fprintf (FILE, "0x%lx", l);                \
  290.     }                            \
  291.       else if (REAL_VALUE_ISINF (VALUE))            \
  292.     {                            \
  293.       if (REAL_VALUE_NEGATIVE (VALUE))            \
  294.         asm_fprintf (FILE, "%I0r-Inf");            \
  295.       else                            \
  296.         asm_fprintf (FILE, "%I0rInf");            \
  297.     }                            \
  298.       else if (REAL_VALUE_MINUS_ZERO (VALUE))            \
  299.     {                            \
  300.       asm_fprintf (FILE, "%I0r-0.0");            \
  301.     }                            \
  302.       else                            \
  303.     { char dstr[30];                    \
  304.       REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr);        \
  305.       asm_fprintf (FILE, "%I0r%s", dstr);            \
  306.     }                            \
  307.     } while (0)
  308.  
  309. #undef ASM_OUTPUT_DOUBLE_OPERAND
  310. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  311.  do { if (REAL_VALUE_ISINF (VALUE))                    \
  312.     {                                \
  313.       if (REAL_VALUE_NEGATIVE (VALUE))                \
  314.         asm_fprintf (FILE, "%I0r-Inf");                \
  315.       else                                \
  316.         asm_fprintf (FILE, "%I0rInf");                \
  317.     }                                \
  318.       else if (REAL_VALUE_ISNAN (VALUE))                \
  319.     {                                \
  320.       long l[2];                            \
  321.       REAL_VALUE_TO_TARGET_DOUBLE (VALUE, l);            \
  322.       asm_fprintf (FILE, "%I");                    \
  323.       fprintf (FILE, "0x%lx%08lx", l[0], l[1]);            \
  324.     }                                \
  325.       else if (REAL_VALUE_MINUS_ZERO (VALUE))                \
  326.     {                                \
  327.       asm_fprintf (FILE, "%I0r-0.0");                \
  328.     }                                \
  329.       else                                \
  330.     { char dstr[30];                        \
  331.       REAL_VALUE_TO_DECIMAL (VALUE, "%.17g", dstr);            \
  332.       asm_fprintf (FILE, "%I0r%s", dstr);                \
  333.     }                                \
  334.     } while (0)
  335.  
  336.  
  337. #define ASM_OUTPUT_EXTERNAL_LIBCALL(asm_out_file,fun)
  338.  
  339. /* This is how we tell the assembler that a symbol is weak.  */
  340. #undef ASM_WEAKEN_LABEL
  341. #define ASM_WEAKEN_LABEL(FILE,NAME) \
  342.   do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
  343.        fputc ('\n', FILE); } while (0)
  344.  
  345.  
  346. /* given that symbolic_operand(X), return TRUE if no special
  347.    base relative relocation is necessary */
  348.  
  349. #define LEGITIMATE_BASEREL_OPERAND_P(X) \
  350.   (flag_pic == 3 && read_only_operand (X))
  351.  
  352. #undef LEGITIMATE_PIC_OPERAND_P
  353. #define LEGITIMATE_PIC_OPERAND_P(X) \
  354.   (! symbolic_operand (X, VOIDmode) || LEGITIMATE_BASEREL_OPERAND_P (X))
  355.  
  356.  
  357. /* Define this macro if references to a symbol must be treated
  358.    differently depending on something about the variable or function
  359.    named by the symbol (such as what section it is in).
  360.  
  361.    The macro definition, if any, is executed immediately after the
  362.    rtl for DECL has been created and stored in `DECL_RTL (DECL)'.
  363.    The value of the rtl will be a `mem' whose address is a
  364.    `symbol_ref'.
  365.  
  366.    The usual thing for this macro to do is to record a flag in the
  367.    `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
  368.    name string in the `symbol_ref' (if one bit is not enough
  369.    information).
  370.  
  371.    On the Atari we use this to indicate if a symbol is in text or
  372.    data space, as well as to distinguish functions from data. */
  373.  
  374. #define ENCODE_SECTION_INFO(DECL)\
  375. do                                    \
  376.   {                                    \
  377.     if (TREE_CODE (DECL) == FUNCTION_DECL)                \
  378.       {                                    \
  379.         SYMBOL_REF_FLAG (XEXP (DECL_RTL (DECL), 0)) = 1;        \
  380.     SYMBOL_REF_USED (XEXP (DECL_RTL (DECL), 0)) = 1;        \
  381.       }                                    \
  382.     else                                \
  383.       {                                    \
  384.     rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd'        \
  385.            ? TREE_CST_RTL (DECL) : DECL_RTL (DECL));        \
  386.     if (RTX_UNCHANGING_P (rtl) && !MEM_VOLATILE_P (rtl))        \
  387.       SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;                \
  388.       }                                    \
  389.   }                                    \
  390. while (0)
  391.  
  392. #if 0
  393. #undef SELECT_RTX_SECTION
  394. #define SELECT_RTX_SECTION(MODE, X)                    \
  395. {                                    \
  396.   if (!flag_pic || LEGITIMATE_BASEREL_OPERAND_P (X))            \
  397.     readonly_data_section();                        \
  398.   else if (LEGITIMATE_PIC_OPERAND_P (X))                \
  399.     readonly_data_section();                        \
  400.   else                                    \
  401.     data_section();                            \
  402. }
  403. #else
  404. #undef SELECT_RTX_SECTION
  405. #define SELECT_RTX_SECTION(MODE, X) readonly_data_section ();
  406. #endif
  407.  
  408. /* according to varasm.c, RELOC referrs *only* to whether constants (!)
  409.    are addressed by address. This doesn't matter in baserelative
  410.    code, so we allow (inspite of flag_pic) readonly_data_section() in
  411.    that case */
  412.  
  413. #undef SELECT_SECTION
  414. #define SELECT_SECTION(DECL, RELOC)                    \
  415. {                                    \
  416.   if (TREE_CODE (DECL) == STRING_CST)                    \
  417.     {                                    \
  418.       if (flag_writable_strings)                    \
  419.     data_section ();                        \
  420.       else                                \
  421.     readonly_data_section ();                    \
  422.     }                                    \
  423.   else if (TREE_CODE (DECL) == VAR_DECL)                \
  424.     {                                    \
  425.       if (TREE_READONLY (DECL)                        \
  426.       && ! TREE_THIS_VOLATILE (DECL)                \
  427.       && DECL_INITIAL (DECL)                    \
  428.       && (DECL_INITIAL (DECL) == error_mark_node            \
  429.           || TREE_CONSTANT (DECL_INITIAL (DECL)))            \
  430.       && !(flag_pic && flag_pic != 3 && RELOC))            \
  431.     readonly_data_section ();                    \
  432.       else                                \
  433.     data_section ();                        \
  434.     }                                    \
  435.   else                                    \
  436.     readonly_data_section ();                        \
  437. }
  438.  
  439. /* Don't default to pcc-struct-return, because gcc is the only compiler, and
  440.    we want to retain compatibility with older gcc versions.  */
  441. #undef PCC_STATIC_STRUCT_RETURN
  442. #define DEFAULT_PCC_STRUCT_RETURN 0
  443.  
  444. /* Define this macro if the system header files support C++ as well
  445.    as C.  This macro inhibits the usual method of using system header
  446.    files in C++, which is to pretend that the file's contents are
  447.    enclosed in `extern "C" {...}'.  */
  448. #define NO_IMPLICIT_EXTERN_C
  449.  
  450. /* for g++ */
  451. #define MATH_LIBRARY "-lm"
  452.  
  453. /* Only for native TOS compiler */
  454. #ifdef atarist
  455.  
  456. #define FILE_NAME_NONDIRECTORY(X)    atari_filename_nondirectory(X)
  457. extern char *atari_filename_nondirectory();
  458.  
  459. #define PATH_SEPARATOR        ','
  460. #define DIR_SEPARATOR        '/'
  461. #define EXECUTABLE_SUFFIX    ".ttp"
  462. #endif
  463.  
  464. /* atari's own version number */
  465. #define ATARI_PL    "c"
  466.